package group.sicher.common.entity;

import group.sicher.common.constant.senum.StatusEnum;

import javax.persistence.*;
import java.util.Objects;

/**
 * @Auth rock
 * @Date 2019/7/1 21:07
 * @description
 */
@Entity
@Table(name = "wm_admin_user")
public class AdminUserEntity {

    private Long id;
    private Long userId;
    private StatusEnum admin;
    private StatusEnum deleted;
    private StatusEnum used;
    private Long companyId;
    private Long createAt;
    private Long updateAt;


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "admin", nullable = false)
    public StatusEnum getAdmin() {
        return admin;
    }

    public void setAdmin(StatusEnum admin) {
        this.admin = admin;
    }

    @Basic
    @Column(name = "deleted", nullable = false)
    public StatusEnum getDeleted() {
        return deleted;
    }

    public void setDeleted(StatusEnum deleted) {
        this.deleted = deleted;
    }

    @Basic
    @Column(name = "used", nullable = false)
    public StatusEnum getUsed() {
        return used;
    }

    public void setUsed(StatusEnum used) {
        this.used = used;
    }

    @Basic
    @Column(name = "company_id", nullable = true)
    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    @Basic
    @Column(name = "create_at", nullable = true)
    public Long getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Long createAt) {
        this.createAt = createAt;
    }

    @Basic
    @Column(name = "update_at", nullable = true)
    public Long getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Long updateAt) {
        this.updateAt = updateAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AdminUserEntity that = (AdminUserEntity) o;
        return id == that.id &&
                userId == that.userId &&
                admin == that.admin &&
                deleted == that.deleted &&
                used == that.used &&
                Objects.equals(companyId, that.companyId) &&
                Objects.equals(createAt, that.createAt) &&
                Objects.equals(updateAt, that.updateAt);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, admin, deleted, used, companyId, createAt, updateAt);
    }
}
